/* Global styles and reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    width: 100%;
    height: 450px;
    position: relative;
}

/* Adjust height for standalone mode */
body.standalone {
    height: 90vh;
}

#app-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Center tooltip for displaying information */
#center-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 14px;
    z-index: 1000;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

#center-tooltip.hidden {
    display: none;
}

/* Story container styling */
.story-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    animation: fadeIn 0.5s ease-in;
}

.character-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    margin-bottom: 15px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    animation: bounce 1s infinite;
}

.dialogue-content {
    background: white;
    padding: 20px;
    border-radius: 15px;
    max-width: 600px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    text-align: center;
}

#dialogue-text {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 15px;
}

/* Action button styling */
.action-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    white-space: nowrap;
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.action-button:active {
    transform: translateY(0);
}

/* Game area */
#game-area {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    overflow: hidden;
}

/* Status bar */
.status-bar {
    display: flex;
    justify-content: space-around;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    cursor: help;
}

.status-item .icon {
    font-size: 20px;
}

/* Mission panel */
.mission-panel {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    margin: 8px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

#mission-text {
    font-size: 14px;
    color: #444;
    text-align: center;
    font-weight: 600;
}

/* Game content area */
.game-content {
    flex: 1;
    display: flex;
    gap: 10px;
    padding: 0 15px 10px 15px;
    overflow-y: auto;
    min-height: 0;
}

/* Fire cards container */
.fire-cards-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Classification zones */
.classification-zones {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.section-label {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin-bottom: 6px;
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    padding: 5px;
    border-radius: 8px;
}

/* Cards grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    flex: 1;
    align-content: start;
}

/* Fire card styling */
.fire-card {
    background: white;
    border-radius: 12px;
    padding: 10px;
    cursor: grab;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    user-select: none;
}

.fire-card:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.fire-card:active {
    cursor: grabbing;
}

.fire-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.fire-card.matched {
    opacity: 0.3;
    pointer-events: none;
}

.card-icon {
    font-size: 32px;
}

.card-label {
    font-size: 11px;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

/* Zones grid */
.zones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    flex: 1;
    align-content: start;
}

/* Drop zone styling */
.drop-zone {
    background: rgba(255, 255, 255, 0.8);
    border: 3px dashed #999;
    border-radius: 12px;
    padding: 10px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-align: center;
}

.drop-zone:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: #667eea;
}

.drop-zone.drag-over {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    border-style: solid;
    transform: scale(1.05);
}

.zone-header {
    font-size: 28px;
    margin-bottom: 4px;
}

.zone-title {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin-bottom: 3px;
}

.zone-description {
    font-size: 10px;
    color: #666;
    line-height: 1.2;
}

.zone-items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    justify-content: center;
}

.zone-item {
    font-size: 20px;
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 8px;
    border-radius: 8px;
}

/* Feedback panel */
.feedback-panel {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 100;
    animation: slideUp 0.3s ease;
}

.feedback-panel.hidden {
    display: none;
}

.feedback-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.feedback-icon {
    font-size: 36px;
}

#feedback-text {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* End screen */
#end-screen {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 20px;
}

#end-screen.hidden {
    display: none;
}

.end-content {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 500px;
}

.end-icon {
    font-size: 80px;
    margin-bottom: 15px;
}

#end-title {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
}

#end-message {
    font-size: 15px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.end-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
}

.stat-label {
    font-weight: 600;
    color: #555;
}

.stat-value {
    font-weight: bold;
    color: #667eea;
    font-size: 18px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .game-content {
        flex-direction: column;
    }
    
    .cards-grid, .zones-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .fire-card {
        padding: 8px;
    }
    
    .card-icon {
        font-size: 28px;
    }
    
    .card-label {
        font-size: 10px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .fire-card,
    .action-button,
    .drop-zone {
        min-height: 44px;
        min-width: 44px;
    }
}